﻿using QuestionnaireInvestigation.Data.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QuestionnaireInvestigation.Data.Service
{
    public class AdminService : IDisposable
    {
        private QuestionnaireInvestigationDBEntities data;
        public AdminService()
        {
            data = new QuestionnaireInvestigationDBEntities();
        }

        public string AdminLogin(string email,string password)
        {
            var admin = data.Admins.SingleOrDefault(a => a.Email == email && a.Password == password);
            if (admin != null)
                return admin.Nickname;
            else
                return null;
        }

        public void GetAdminInfo()
        {
            throw new NotImplementedException();
        }

        public void Dispose()
        {
            data.Dispose();
        }
    }
}
